package coder.nav.config;

import coder.nav.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    /**
     * 注册拦截器
     * @author Bosen 2022/11/29 21:47
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        JwtUtils.redisTemplate = redisTemplate;
        registry.addInterceptor(new JwtConfig()).addPathPatterns("/**");
    }

}
